var __table;
$(document).ready(function() {
    //引导操作
    SessionUtil.showOneTimeTip("search_guide_tip", function(){
        introJs().start().onbeforeexit(function () {
            dialogTip("开始搜索您的问题吧", 'info', 1500);
            $("#dope").focus();
            return true;
        });

    });

    //eg: http://www.gbtags.com/gb/rtwidget-replayerpreview/928.htm
    $('#datatables').DataTable({
        serverSide: true, //开启服务器模式
        responsive: true,   //响应式
        processing: true,
        ordering: false,
        searchDelay: 0,
        ajax: {
            url: ctx+'/adminConsole/searchOptimize/search?module=qa',
            type: 'POST',
            "data": function ( d ) {
                return $.extend( {}, d, {
                    "keyword": $("#datatables_filter input").val(),
                    "QF__EQ__firstCategoryId": $(".conLeft li.bg").children('.liRight').children('.intername').data("id")
                } );
            }
        },
        "initComplete": function () {
            __table = this.api();
        },
        columns: [
            {
                "data": "action"
            },
            {
                "data": "score"
            },
            {
                "data": "question"
            },
            {
                "data": "answer"
            },
            {
                "data": "categoryId"
            }
        ],
        "columnDefs": [{
            // "visible": false, "targets": 0
        },{
            "render": function(data, type, row, meta) {
                //var kw = $("#datatables_filter input").val();
                //if(CommUtil.isNotEmpty(kw)){
                    return '<a class="font-13 text-warning" href="javascript:caina('+meta.row+', \'tasks-sys\')"><i class="fa fa-heart"></i>采纳</a>';
                //}else{
                //    return "";
                //}
            }, "targets": 0}

        ]
    });
});

